package com.appbee.core.client.startup.links;

import javax.inject.Inject;

import com.appbee.core.client.startup.StartupChain;
import com.appbee.core.client.startup.StartupLink;
import com.google.gwt.activity.shared.ActivityManager;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.gwt.user.client.ui.HasWidgets.ForIsWidget;

public class ActivityManagerLink implements StartupLink
{

	private final EventBus eventBus;
	private final ActivityMapper activityMapper;

	@Inject
	public ActivityManagerLink(EventBus eventBus, ActivityMapper activityMapper)
	{
		this.eventBus = eventBus;
		this.activityMapper = activityMapper;
	}

	@Override
	public void start(ForIsWidget container, StartupChain chain)
	{
		ActivityManager man = new ActivityManager(activityMapper, eventBus);
		man.setDisplay((AcceptsOneWidget) container);
		chain.start(container);
	}

}
